package org.hhchat.others.didi;

import java.util.Scanner;

/**
 * Created this one by HMH on 2017/8/26.
 */
public class exam01 {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        String line = scanner.nextLine();
        String[] numberStrs = line.split("\\s");
        int[] numbers = new int[numberStrs.length];
        for(int i=0;i<numberStrs.length;i++) {
            numbers[i] = Integer.valueOf(numberStrs[i]);
        }
        Long integerSum = maxSum(numbers);
        System.out.println(integerSum);
    }

    private static Long maxSum(int[] numbers) {
        long sum = 0, maxx = Long.MIN_VALUE;
        for(int i=0;i<numbers.length;i++) {
            sum+=numbers[i];
            if(sum>=maxx){
                maxx = sum;
            } else if (sum < 0) {
                sum = 0;
            }
        }
        return maxx;
    }
}
